#ifndef FOREST_COMPILER_H
#define FOREST_COMPILER_H
#include "forest.h"
#include "parser.h"

class ForestCompiler : public Forest
{
public:
    ForestCompiler() : Forest() {};
    ForestCompiler(string input, string output) : Forest(input, output)
    {
        parser_ = new Parser(input_file_name_);
    }
    virtual ~ForestCompiler()
    {
        if (parser_ != nullptr) {
            delete parser_;
        }
    }
    bool run() override
    {
        cout << "run in ForestCompiler" << endl;
        parser_->Parse();
        cout << "Finish compile file " << input_file_name_ << ", result wrote to " << output_file_name_ << endl;
        exit(0);
    };
private:
    Parser* parser_;
};

#endif // FOREST_COMPILER_H